<?php
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$return['shop']=pdo_get('jy_commission_shop',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
if($_RQ['op']=='main'){
	$member=pdo_get('core_members',array('id'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']),array('credit1','credit2','mobile','groupid','avatar','nickname'));
	$return['shop']['title']=$return['shop']['title']?$return['shop']['title']:$member['nickname'].'的小店';
	$return['shop']['logo']=tomedia($return['shop']['logo']);
	exi($return);
}
if($_RQ['op']=='post'){
	$postdata=get_postdata();
	$data=array_fields(array('img','logo','title','desc','mobile','wechat'),$postdata);
	if($return['shop']){
		pdo_update('jy_commission_shop',$data,array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	}else{
		$data['mid']=$_SESSION['uid'];
		$data['uniacid']=$_SESSION['uniacid'];
		pdo_insert('jy_commission_shop',$data);
	}
	
	exi('设置成功','','goback');
}
?>